﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Admin.aspx.cs" Inherits="Admin_Default" EnableEventValidation="false" %>

<%@ Register Src="~/Controls/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="asp" %>
<%@ Register Assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    Namespace="System.Web.UI.WebControls" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script src="JS/jquery-1.3.2.js" type="text/javascript"></script>

    <script src="JS/jquery.MultiFile.js" type="text/javascript"></script>

    <link href="css/lightbox.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="js/prototype.js"></script>

    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>

    <script type="text/javascript" src="js/lightbox.js"></script>

    <h2>
        商品图片管理</h2>
    <asp:ScriptManagerProxy runat="server" ID="ScriptManagerProxy1">
    </asp:ScriptManagerProxy>
    &nbsp;&nbsp;&nbsp; <span>请选择商品 </span>
    <asp:DropDownList ID="ddlProduct" runat="server" AutoPostBack="True" CssClass="droplist"
        OnSelectedIndexChanged="ddlProduct_SelectedIndexChanged" 
        DataSourceID="EntityDataSource1" DataTextField="Name" DataValueField="ID">
    </asp:DropDownList>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=NCCITPubSaleEntities" 
        DefaultContainerName="NCCITPubSaleEntities" EntitySetName="Product" 
        Select="it.[ID], it.[Name]">
    </asp:EntityDataSource>
    <br />
    <br />
    <asp:UpdatePanel ID="UP1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">
        <ContentTemplate>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
                CssClass="gridview" AutoGenerateColumns="False" OnPageIndexChanging="GridView1_PageIndexChanging">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" />
                    <asp:TemplateField HeaderText="预览">
                        <ItemTemplate>
                            <a href='<%# Eval("Path") %>' rel="lightbox[roadtrip]">
                                <img src='<%# Eval("Path") %>' width="32" height="24" alt="" /></a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Path" HeaderText="路径" SortExpression="Path" />
                    <asp:CommandField ShowEditButton="True" HeaderText="修改路径" />
                    <asp:CommandField ShowDeleteButton="True" HeaderText="删除图片" />
                </Columns>
                <PagerStyle CssClass="footer" />
                <PagerTemplate>
                    <asp:GridViewPager runat="server" />
                </PagerTemplate>
                <EmptyDataTemplate>
                    There are currently no items in this table.
                </EmptyDataTemplate>
            </asp:GridView>
            <br />
            <br />
            <div>
                <table class="gridview" cellspacing="0" rules="all" border="1" id="Upload" style="border-collapse: collapse;">
                    <tr>
                        <td>
                            为商品
                            <label id="CurrentProduct" runat="server" style="color: Green">
                            </label>
                            上传图片：
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlProduct" EventName="SelectedIndexChanged" />
        </Triggers>
    </asp:UpdatePanel>
    <table class="gridview" cellspacing="0" rules="all" border="1" id="Table1" style="border-collapse: collapse;">
        <tr>
            <td>
                请选择文件并上传：
                <asp:FileUpload ID="FileUpload1" runat="server" class="multi" accept="gif|jpg|png" />
                <br />
                <asp:Button ID="btnUpload" runat="server" Text="Upload All" OnClick="btnUpload_Click" />
            </td>
        </tr>
    </table>
    <asp:Button ID="Button1" runat="server" Style="display: none" />
    <AjaxControlToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="Button1"
        PopupControlID="PNL2" CancelControlID="ButtonCancel2" BackgroundCssClass="modalBackground" />
    <asp:Panel ID="PNL2" runat="server" Style="display: none; width: 600px; background-color: White;
        border-width: 2px; border-color: Black; border-style: solid; padding: 20px;">
        <div id="MPE2" runat="server">
        </div>
        <br />
        <br />
        <div style="text-align: right;">
            <asp:Button ID="ButtonCancel2" runat="server" Text="OK" />
        </div>
    </asp:Panel>
    <script type="text/javascript">
        function ShowMPE(message) {
            $get("<%=MPE2.ClientID %>").innerHTML = message;
            $find("<%=ModalPopupExtender2.ClientID %>").show();
        }
    </script>

</asp:Content>
